package com.ushine.web.component.design.chain.salary.handler;

import com.ushine.web.component.design.chain.salary.config.AbstractSalaryCalculateHandler;
import com.ushine.web.component.design.chain.salary.model.SalaryCalculateBO;
import com.ushine.web.component.http.HttpResponseVO;
import lombok.Data;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * @Author: yls
 * @Date: 2022/03/04 10:17
 * @Description: 薪资计算完成，保存薪资计算结果
 * @Version 1.0
 */
@Data
@Service
public class SaveCalculateResultHandler extends AbstractSalaryCalculateHandler {

    @Override
    @Transactional(rollbackFor = Exception.class)
    public HttpResponseVO<?> process(SalaryCalculateBO salaryCalculate) {

        /*
         * 保存薪资计算结果，如果保存成功，则返回成功提示信息
         * 保存失败，返回具体的错误信息，必须保证数据能够回滚
         */

        return new HttpResponseVO<>().ok("成功保存薪资计算结果，薪资计算流程完成。",salaryCalculate);
    }
}
